package entity.item;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;

import loading.ImageLoader;
import main.GameList;
import main.Inventory;
import entity.Entity;

public class Item extends Entity
{
	private Inventory inv;
	private String name;
	public Item(Point2D pos, GameList game, ImageLoader img, String name) 
	{
		super(pos, game, img);
		this.name = name;
		inv = null;
	}
	//give the item an inventory so its name will be drawn
	public void setInventory(Inventory inv)
	{
		this.inv = inv;
	}
	@Override
	public void draw(Graphics2D g)
	{
		super.draw(g);
		if (inv != null)
		{
			g.setColor(Color.white);
			g.drawString(name, (int)(getPosition().getX()-name.length()/2*7), (int)(getPosition().getY()-15));
			g.setColor(Color.black);
		}
	}
}
